package net.lzzy.practices.web.models;

import lombok.Getter;
import net.lzzy.practices.entities.Chapter;

import java.util.Date;
import java.util.UUID;

/**
 * @author 渊何
 */
@Getter
public class VmChapter {
    private final UUID id;
    private final String name;
    private final String desc;
    private final boolean open;
    private final Date createTime;
    private final Date updateTime;
    private final int countQuestion;
    private final UUID courseId;

    public VmChapter(Chapter chapter){
        id = chapter.getId();
        name = chapter.getName();
        desc = chapter.getDescription();
        open = chapter.isOpen();
        createTime = chapter.getCreateTime();
        updateTime = chapter.getUpdateTime();
        countQuestion = chapter.getQuestions().size();
        courseId = chapter.getCourse().getId();
    }
}
